package com.zoey.boot.controller;

import com.zoey.boot.entity.Student;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: 为前端模版测试提供接口
 * @Author: sxgan
 * @Date: 2024-01-27 09:25
 * @Version: 1.0
 **/
@RestController
@RequestMapping("/test/api")
public class FrontServerController {

    /**
     * 返回一个学生对象
     *
     * @return
     */
    @GetMapping("/getStudent")
    public Student getStudent() {
        Student student = new Student();
        student.setId(10001);
        student.setName("Zoey");
        student.setAge(25);
        return student;
    }

    /**
     * 返回一个学生对象
     *
     * @return
     */
    @PostMapping("/getStudentById")
    public Student getStudentById(@RequestBody Student student) {
        student.setName("ZoeyById");
        student.setAge(22);
        return student;
    }
}
